package com.alipay.demo.trade.model.builder;

import java.util.List;
import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;

import com.alipay.demo.trade.model.ExtendParams;
import com.google.gson.annotations.SerializedName;

public class AlipayTradePayContentBuilder extends AlipayTradePrecreateContentBuilder {

    private String scene = "bar_code";
    @SerializedName("auth_code")
    private String authCode;

    public boolean validate() {
        if (StringUtils.isEmpty(this.scene)) {
            throw new NullPointerException("scene should not be NULL!");
        } else if (StringUtils.isEmpty(this.authCode)) {
            throw new NullPointerException("auth_code should not be NULL!");
        } else if (!Pattern.matches("^\\d{10,}$", this.authCode)) {
            throw new IllegalStateException("invalid auth_code!");
        } else {
            return super.validate();
        }
    }

    public String toString() {
        StringBuilder sb = new StringBuilder("AlipayTradePayContentBuilder{");
        sb.append("scene=\'").append(this.scene).append('\'');
        sb.append(", authCode=\'").append(this.authCode).append('\'');
        sb.append(", outTradeNo=\'").append(this.getOutTradeNo()).append('\'');
        sb.append(", sellerId=\'").append(this.getSellerId()).append('\'');
        sb.append(", totalAmount=\'").append(this.getTotalAmount()).append('\'');
        sb.append(", discountableAmount=\'").append(this.getDiscountableAmount()).append('\'');
        sb.append(", undiscountableAmount=\'").append(this.getUndiscountableAmount()).append('\'');
        sb.append(", subject=\'").append(this.getSubject()).append('\'');
        sb.append(", body=\'").append(this.getBody()).append('\'');
        sb.append(", goodsDetailList=").append(this.getGoodsDetailList());
        sb.append(", operatorId=\'").append(this.getOperatorId()).append('\'');
        sb.append(", storeId=\'").append(this.getStoreId()).append('\'');
        sb.append(", alipayStoreId=\'").append(this.getAlipayStoreId()).append('\'');
        sb.append(", terminalId=\'").append(this.getTerminalId()).append('\'');
        sb.append(", extendParams=").append(this.getExtendParams());
        if (StringUtils.isNotEmpty(this.getTimeExpress())) {
            sb.append(", timeExpire=\'").append(this.getTimeExpire()).append('\'');
        }

        sb.append(", timeExpress=\'").append(this.getTimeExpire()).append('\'');
        sb.append('}');
        return sb.toString();
    }

    public String getScene() {
        return this.scene;
    }

    public AlipayTradePayContentBuilder setScene(String scene) {
        this.scene = scene;
        return this;
    }

    public String getAuthCode() {
        return this.authCode;
    }

    public AlipayTradePayContentBuilder setAuthCode(String authCode) {
        this.authCode = authCode;
        return this;
    }

    public AlipayTradePayContentBuilder setAlipayStoreId(String alipayStoreId) {
        return (AlipayTradePayContentBuilder) super.setAlipayStoreId(alipayStoreId);
    }

    public AlipayTradePayContentBuilder setBody(String body) {
        return (AlipayTradePayContentBuilder) super.setBody(body);
    }

    public AlipayTradePayContentBuilder setDiscountableAmount(String discountableAmount) {
        return (AlipayTradePayContentBuilder) super.setDiscountableAmount(discountableAmount);
    }

    public AlipayTradePayContentBuilder setExtendParams(ExtendParams extendParams) {
        return (AlipayTradePayContentBuilder) super.setExtendParams(extendParams);
    }

    public AlipayTradePayContentBuilder setGoodsDetailList(List goodsDetailList) {
        return (AlipayTradePayContentBuilder) super.setGoodsDetailList(goodsDetailList);
    }

    public AlipayTradePayContentBuilder setOperatorId(String operatorId) {
        return (AlipayTradePayContentBuilder) super.setOperatorId(operatorId);
    }

    public AlipayTradePayContentBuilder setOutTradeNo(String outTradeNo) {
        return (AlipayTradePayContentBuilder) super.setOutTradeNo(outTradeNo);
    }

    public AlipayTradePayContentBuilder setSellerId(String sellerId) {
        return (AlipayTradePayContentBuilder) super.setSellerId(sellerId);
    }

    public AlipayTradePayContentBuilder setStoreId(String storeId) {
        return (AlipayTradePayContentBuilder) super.setStoreId(storeId);
    }

    public AlipayTradePayContentBuilder setSubject(String subject) {
        return (AlipayTradePayContentBuilder) super.setSubject(subject);
    }

    public AlipayTradePayContentBuilder setTerminalId(String terminalId) {
        return (AlipayTradePayContentBuilder) super.setTerminalId(terminalId);
    }

    public AlipayTradePayContentBuilder setTimeExpire(String timeExpire) {
        return (AlipayTradePayContentBuilder) super.setTimeExpire(timeExpire);
    }

    public AlipayTradePayContentBuilder setTotalAmount(String totalAmount) {
        return (AlipayTradePayContentBuilder) super.setTotalAmount(totalAmount);
    }

    public AlipayTradePayContentBuilder setUndiscountableAmount(String undiscountableAmount) {
        return (AlipayTradePayContentBuilder) super.setUndiscountableAmount(undiscountableAmount);
    }

    public AlipayTradePayContentBuilder setTimeExpress(String timeExpress) {
        return (AlipayTradePayContentBuilder) super.setTimeExpress(timeExpress);
    }
}
